home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d13
/
pcrsep89.arc
/
CA.BI
< prev
next >
Wrap
Text File
|
1990-03-21
|
5KB
|
123 lines
' Include this file at the beginning of every Quick Basic program.
'******************
' CAINIT initializes the Cellular Automaton library and selects a video mode
' Mode 1: Monochrome text, alter & display character values
' Mode 2: Monochrome text, alter & display attribute values
' Mode 3: CGA text, alter & display character values
' Mode 4: CGA text, alter & display attribute values
' Mode 5: CGA 4-color graphics, 320 x 200 display
' Mode 6: EGA/VGA 16-color graphics, 640 x 350 display (256K EGA/VGA only)
' Note: it is your responsiblity to pick modes which your video apapter
' and monitor support. The library does not check your hardware
' for you.
' The second parameter is usually specified as VARPTR(CaArray(0)) unless
' you have a reason to use a different array.
'******************
DECLARE FUNCTION CAINIT% (BYVAL Modenum%, BYVAL ArrayPtr%)
'******************
' CARESET returns the video system to its starting mode
'******************
DECLARE SUB CARESET ()
'******************
' CAWRAP allows or diallows left-to-right wrap around of the
' universe. When wrap is allowed, cells at the far right side of
' the display are neighbors of those on the far left and vice versa.
' CAWRAP (0) turns off wrap-around (the default)
' CAWRAP (any non-zero value) turns on wrap-around
'******************
DECLARE SUB CAWRAP (BYVAL LogicalValue%)
'******************
' CABORDER sets the value used in the border cells. The top and bottom
' border cells always exist. Left and right border cells only exist
' if wrap-around is turned off. BorderValue% must be < 256.
'******************
DECLARE SUB CABORDER (BYVAL BorderValue%)
'******************
' CACHAR sets, in text modes, the default or 'empty' character used in
' the display. It has no effect on graphics modes. By default, this
' value is a space character (ASCII 32). ClearChar% must be < 256.
'******************
DECLARE SUB CACHAR (BYVAL ClearChar%)
'******************
' CACOLOR. In text modes, this sets the background attribute value. In
' color modes, it sets the background color. By default, this is set
' to 7 (white on black) in text modes and 0 in color modes.
' ClearColor% must be < 256.
'******************
DECLARE SUB CACOLOR (BYVAL ClearColor%)
'******************
' CACLEAR clears both the buffer and display and resets them to their
' 'empty' values.
'******************
DECLARE SUB CACLEAR ()
'******************
' CASIZE in graphics modes sets the number of rows and columns in the
' unvierse, and number of times each cell's value is repeated both
' vertically and horizontally on the display. It is your responsibility
' to be sure that (Rows + 4) * (Cols +2) <= 65536,
' that (Rows * RowRepeat) <= vertical size of your screen
' and that (Cols * ColRepeat) <= horizontal size of your screen
' for the graphics mode you have selected with CAINIT.
'******************
DECLARE SUB CASIZE (BYVAL Rows%,BYVAL Cols%,BYVAL RowRepeat%,BYVAL ColRepeat%)
'******************
' CASHOW will display the present contents of the universe on your screen.
'******************
DECLARE SUB CASHOW ()
'******************
' CASET will directly set values in the universe buffer. Use it to set
' a starting configuration before you start the universe in motion.
' The values set with CASET will not appear on the screen until you
' call CASHOW
'******************
DECLARE SUB CASET (BYVAL Row%, BYVAL Column%, BYVAL Value%)
'******************
' CAGEN creates one new generation of your universe and displays in on
' the screen. It makes repeated calls to CACELL, your rule function,
' to find the new value of each cell in the universe.
'******************
DECLARE SUB CAGEN ()
'******************
' CACELL is a function you write to determine the value a cell should
' have in the next generation. The shorter and faster this function
' is, the faster your program will run.
'******************
DECLARE FUNCTION CACELL% ()
'******************
' CaArray is the array which contains information about one cell and
' its neighbors each time CACELL is called. The constants below
' describe how information is stored in the array. The array must
' be declared as STATIC, SHARED, and COMMON as shown.
'******************
' $STATIC
DIM SHARED CaArray%(10)
COMMON CaArray%()
' Positions in the Array
CONST NorthWest = 0
CONST North = 1
CONST NorthEast = 2
CONST West = 3
CONST Self = 4
CONST East = 5
CONST SouthWest = 6
CONST South = 7
CONST SouthEast = 8
CONST SelfRow = 9
CONST SelfCol =10